package util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.LinkedList;
import java.util.List;

public class Worker {
	public List<String[]> getLatLonBetweenTimes(Connection conn,
			String starttime, String endtime) throws Exception {
		List<String[]> list = new LinkedList<String[]>();
		String query = "";
		Statement stmt = conn.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		while (rs.next()) {
			// loop here
		}
		rs.close();
		stmt.close();
		return list;
	}

	public String oraLookup(File initOraFile, String keyword) {
		String result = "";
		try {
			BufferedReader br = new BufferedReader(new FileReader(initOraFile));
			String line;
			while ((line = br.readLine()) != null) {
				if (line.contains(keyword)) {
					result += line;
				}
			}

		} catch (IOException e) {
			e.printStackTrace();
		}
		return result;
	}

	public void updateTable(Connection conn,String tablename, String keyName, String keyval, String paramName, String paramval){
		String update = "UPDATE "+tablename + " SET "+paramName+"="+paramval+" WHERE "+keyName+"="+keyval;
		try {
			Statement stmt = conn.createStatement();
			stmt.executeUpdate(update);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}
}
